package com.yyj.jan.check.controller;
import com.yyj.jan.HttpUtil;
import com.yyj.jan.check.Check;
import com.yyj.jan.check.CheckApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@CrossOrigin
public class CheckController {

    private CheckApi checkApi;

    @Autowired
    public CheckController(final CheckApi checkApi) {
        this.checkApi = checkApi;
    }


    @RequestMapping(value="/toCheck",method = RequestMethod.GET)
    public String toCheckError(){
        return "/check";
    }

    @RequestMapping(value="/check_ai",method = RequestMethod.POST)
    @ResponseBody
    public String check_ai(String data)throws Exception{
       // String res = checkApi.getCheck(data);
        String urlPath = new String("接口地址");
        //发送http请求,返回json字符串
       String mess = HttpUtil.httpSend(data,urlPath);
        return mess;
    }
}
